var zi = {
    ___catch_change: function() {
        if (arguments[0] === undefined) {
            console.log('zi error:shuold input chach error');
        };
        this.___catch = arguments[0];
    },
    ___shut: function() {
        this.shutdown = 1;
    },
    ___def: function() {
        if (protect === undefined) for (; i < len; i++) {
            if (now[addr[i]] === undefined) {
                now[addr[i]] = {};
            }
            now = now[addr[i]];
        };
        if (arguments[0] !== undefined && arguments[0].constructor !== Function) {
            console.log('zi error:please input function');
            return false;
        };
        this[0][this[1]] = arguments[0];
        return true;
    },
    ___senter: function() {
        var res = this[0];
        var addr = this[1];
        var now;
    },
    ___error: function() {
        console.log('zi error:using error function');
        return false;
    },
    _: function() {
        var res = {
            out: 0
        };
        var stack = [];
        var addr = [];
        for (var len = arguments.length,
        i = 0; i < len; i++) {
            stack[len - 1 - i] = arguments[i];
        };
        if (stack.length === 0) {
            console.log('zi error:none addr');
            return zi.___error;

        };
        for (var limit = 1,
        data; stack.length != 0 && limit < 50; limit++) {
            switch ((data = stack.pop()).constructor) {
            case String:

                var i;
                switch (i = data.indexOf(':')) {
                case - 1 : if (data.indexOf(' ') !== -1 || data === '') {
                        console.log('zi error:addr has space or //');
                        return zi.___error;
                    }
                    if (data[0] === '/') {
                        data = data.substring(1);
                        addr = [];
                        res.out = 0;
                        res.gobal = 1;
                        if (data.length > 1) stack.push(data);
                        break;
                    }

                    var temp;

                    switch ((temp = data.split('/')).length) {
                    case 1:
                        switch (temp[0][0]) {
                        case '.':
                            var floor;
                            function check(Snum) {
                                num = parseInt(Snum);
                                if (isNaN(num) || (num - Math.pow(10, Snum.length - 1) < 0)) return false;
                                return num;
                            };
                            if (temp[0][1] === '.' && temp[0].length === 2) {
                                stack.push('.1');

                            } else if (temp[0].length === 1) {
                                stack.push('.0');
                            } else if (floor = check(temp[0].substring(1))) {
                                for (var len = addr.length,
                                i = 0; i < len && floor > 0; i++, floor--) {
                                    addr.pop();
                                };
                                res.out += floor;
                            } else {
                                console.log('zi error:using \'.\' in wrong way');
                                return zi.___error;
                            }
                            break;
                        default:
                            addr.push(temp[0]);
                        }
                        break;
                    default:
                        stack = stack.concat(temp.reverse());

                    }
                    break;
                case 0:
                    if (res.config === undefined) {
                        res.config = data.substring(1)
                    } else {
                        console.log('zi error:two config');
                        return zi.___error;
                    };
                    break;
                default:
                    stack.push(data.substring(0, i), data.substring(i));
                }
                break;

            }

        };
        var protect;
        var now = this[0];
        if (res.gobal === 1) {
            if (res.out !== 0) {
                protect = 1;
                console.log('zi get error:out of root');
                return zi.___error;
            }
            now = zi;
            protect = 1;
        } else for (; res.out > 0; res.out--) {
            if (now.__parent === now) {
                console.log('zi get error:out of root');
                return zi.___error;
            }
            now = this[1];
            protect = 1;
        };
        var len = addr.length;
        var i = 0;
        var def = 0;
        var result;
        var p;
        switch (res.config) {
            case '()=':
                def ? (def++, config = 1) : 1;
            case 'msg=':
                def ? (def++, config = 2) : 1;
            case 'catch=':
                def ? (def++, config = 3) : 1;
                result=zi.___def.bind([now, res.config]);
                p=1;
                break;
            case 'catch':
                result=zi.___catch_change.bind(now);
            case 'shutdown':
                result= zi.___shut.bind(now);
                break;
            case undefined:
                var alive;
                for (; i < len; i--) {
                    if (now[addr[i]] === undefined) {
                        dead = 1;
                        break;
                    };
                    now = now[addr[i]];
                };
                break;
            case 'shutdown':
                return zi.___shut.bind(now);
            var data;
            if (config.substring(0, 3) === 'msg:') {
                data = config.substring(3).split(':');
            } else {
                
            };
        }
        console.log('zi error:unnow error');
        return zi.___error;
    },
    node: {},
};